package spring.framework.context.event;

import spring.framework.beans.factory.BeanFactory;
import spring.framework.context.ApplicationEvent;
import spring.framework.context.ApplicationListener;

/**
 * @author pengzh
 * @desc
 * @class SimpleApplicationEventMulticaster
 * @since 2021-11-25
 */
public class SimpleApplicationEventMulticaster extends AbstractApplicationEventMulticaster {

    public SimpleApplicationEventMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @Override
    public void multicastEvent(ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListener(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
